#include "bullet.h"

bullet::bullet() {
    m_bullet.load(":/zhu.png");
    m_x=GAME_HEIGHT *0.5-m_bullet.width()*0.5;
    m_y=GAME_HEIGHT;
    m_free=true;
    m_speed=BULLET_SPEED;
    m_rect.setWidth(m_bullet.width());
    m_rect.setHeight(m_bullet.height());
    m_rect.moveTo(m_x,m_y);
}
void bullet::updateposition()
{
    if(m_free){
        return;
    }
    m_y-=m_speed;
    m_rect.moveTo(m_x,m_y);
    if(m_y<=-m_rect.height()){
        m_free=true;
    }
}
